package com.yiip.gmall.manager.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiip.gmall.beans.PmsBaseSaleAttr;
import com.yiip.gmall.beans.PmsProductInfo;
import com.yiip.gmall.manager.mapper.ProductInfoMapper;
import com.yiip.gmall.manager.mapper.ProductSaleAttrMapper;
import com.yiip.gmall.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {


    @Autowired
    ProductInfoMapper productInfoMapper;

    @Autowired
    ProductSaleAttrMapper productSaleAttrMapper;

    @Override
    public List<PmsProductInfo> spuList(String catalog3Id) {
        QueryWrapper<PmsProductInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("catalog3_id",catalog3Id);
        List<PmsProductInfo> pmsProductInfoList = productInfoMapper.selectList(queryWrapper);
        return pmsProductInfoList;
    }

    @Override
    public List<PmsBaseSaleAttr> baseSaleAttrList() {
        List<PmsBaseSaleAttr> pmsBaseSaleAttrList = productSaleAttrMapper.selectList(null);
        return pmsBaseSaleAttrList;
    }
}
